package com.dycx.food.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 商品性质
 */
@Getter
@AllArgsConstructor
public enum GoodsNatureEnum {

    PHYSICAL_OBJECT(1, "实物商品"),
    VIRTUAL(2, "虚拟商品");

    private final Integer code;
    private final String name;

    public static GoodsNatureEnum getCode(Integer code) {
        for (GoodsNatureEnum enums : GoodsNatureEnum.values()) {
            if (enums.getCode().equals(code)) {
                return enums;
            }
        }

        return null;
    }
}
